package demo4;

public class Test {
    public static void eat(Animal animal){
        animal.eat();
    }
    public static void run(IRunning iRunning){
        iRunning.run();
    }
    public static void swim(ISwimming iSwimming){
        iSwimming.swim();
    }

    private static void fly(IFlying iFlying){
        iFlying.fly();;
    }
    public static void main(String[] args) {
        eat(new Dog("旺财"));
        eat(new Duck("唐老鸭"));

        System.out.println("-------");

        run(new Dog("旺财"));
        run(new Duck("唐老鸭"));

        System.out.println("-------");

        swim(new Dog("旺财"));
        swim(new Duck("唐老鸭"));

        System.out.println("-------");

        fly(new Duck("唐老鸭"));
    }

}
